package edu.sctu.zhengsenwen.month201506.day20150601;

/**
 * Created by user15 on 2015/6/2.
 */
public class BySubway {

    public void subway() {

            Passengers passengers = new PassengerData().PassengerData().get(0);

            if (passengers.getCard()) {

                if (new Check(passengers).checkBag()) {

                    System.out.println("包裹有违禁品");

                } else {

                    if (new Check(passengers).checkWater()) {

                        System.out.println("水有问题");
                    } else {

                        if (passengers.getPrice() > 2) {

                            System.out.println("进站");
                        } else {
                            new SubwayCard().addPrice(20, passengers);

                            System.out.println("充值成功");
                        }

                        if (passengers.getPrice() >= new SubwayCard().getPrice(passengers.getStart(), passengers.getEnd())) {

                            System.out.println("出站,余额为:" + (passengers.getPrice() - new SubwayCard().getPrice(passengers.getStart(), passengers.getEnd())));

                        } else {
                            new SubwayCard().addPrice(10, passengers);

                            System.out.println("充值成功");
                        }
                    }
                }

            } else {
                System.out.println("买票");

                if (new Check(passengers).checkBag()) {

                    System.out.println("包裹有违禁品");
                } else {
                    if (new Check(passengers).checkWater()) {

                        System.out.println("水有问题");
                    } else {
                        System.out.println("出站");
                    }

                }
            }
        }
    }

